package com.example.chapter7.dao;

import com.example.chapter7.util.DBconnection;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class AdminDao {
    DBconnection DBCoon=new DBconnection();
    public boolean CheckLogin(String s1,String s2) throws SQLException {
        Connection conn = DBCoon.getConn();
        Statement statement = conn.createStatement();
        ResultSet rs = null;
        boolean OK = true;
        String sql = "select * from admin where AdminName ='"+ s1+"' and AdminPwd ='"+s2+"'";
        rs = statement.executeQuery(sql);
        if (!rs.next()){
            OK =false;
        }else{
            OK =true;
        }
        return OK;
    }
}